
		<div class="easyui-layout" data-options="fit:true">
			<input id="bbexp" type="hidden" value="${bbExp ! }" >
			<input id="kbexp" type="hidden" value="${kbExp! }" >
			<input id="exp" type="hidden" value="${Exp! }" >
			<input id="partnum" type="hidden" value="${partnum! }" >
			<table id="productGXCTable" class="easyui-datagrid" style="height:100%;">
				<thead frozen="true">
					<tr>
						<th data-options="field:'date',width:100,align:'center'">日期</th>
						
					</tr>
				</thead>
				<thead>
						<tr>
						 <th data-options="field:'jy_num',width:100,align:'center',colspan:2,rowspan:2" >结余产品次数</th> 
							<th data-options="field:'gm_num',width:100,align:'center',colspan:2,rowspan:2" >购买产品次数</th>
							<th data-options="field:'sy_num',width:100,align:'center',colspan:2*(${partnum! }+1)" >使用产品次数</th>
							
						</tr>
						<tr>
							

									<th data-options="field:'5',width:120,align:'center',colspan:${partnum! }+1" >本草焕能紧肤膏(25次/瓶)</th>
									<th data-options="field:'3',width:120,align:'center',colspan:${partnum! }+1" >本草焕能紧肤精油(50次/瓶)</th>
								
						</tr>
						<tr>
							 <th data-options="field:'jyjy',width:130,align:'center'" >本草焕能紧肤膏(25次/瓶)</th>
									<th data-options="field:'gjy',width:140,align:'center'" >本草焕能紧肤精油(50次/瓶)</th> 
									<th data-options="field:'jygm',width:130,align:'center'" >本草焕能紧肤膏(25次/瓶)</th>
									<th data-options="field:'ggm',width:140,align:'center'" >本草焕能紧肤精油(50次/瓶)</th>
								
									<th data-options="field:'ybg',width:50,align:'center'" formatter = "format_sy">腰部</th>
									<th data-options="field:'gbg',width:50,align:'center'" formatter = "format_sy">胳膊</th>
									<th data-options="field:'dtg',width:50,align:'center'" formatter = "format_sy">大腿</th>
									<th data-options="field:'xtg',width:50,align:'center'" formatter = "format_sy">小腿</th>
									<%if(bbExp=='1'){%>
									<th data-options="field:'bbg',width:50,align:'center'" formatter = "format_sy">背部</th>
									<%}%>
									<%if(kbExp=='1'){%>
									<th data-options="field:'kbg',width:50,align:'center'" formatter = "format_sy">胯部</th>
									<%}%>
									<%if(Exp=='1'){%>
									<th data-options="field:'zfrg',width:50,align:'center'"formatter = "format_sy" >左副乳</th>
									<th data-options="field:'yfrg',width:50,align:'center'" formatter = "format_sy">右副乳</th>
									<%}%>
									<th data-options="field:'sumg',width:100,align:'center'" formatter = "format_sy">使用次数合计</th>
									<th data-options="field:'ybjy',width:50,align:'center'" formatter = "format_sy">腰部</th>
									<th data-options="field:'gbjy',width:50,align:'center'" formatter = "format_sy">胳膊</th>
									<th data-options="field:'dtjy',width:50,align:'center'" formatter = "format_sy">大腿</th>
									<th data-options="field:'xtjy',width:50,align:'center'" formatter = "format_sy">小腿</th>
									<%if(bbExp=='1'){%>
									<th data-options="field:'bbjy',width:50,align:'center'" formatter = "format_sy">背部</th>
									<%}%>
									<%if(kbExp=='1'){%>
									<th data-options="field:'kbjy',width:50,align:'center'" formatter = "format_sy">胯部</th>
									<%}%>
									<%if(Exp=='1'){%>
									<th data-options="field:'zfrjy',width:50,align:'center'" formatter = "format_sy">左副乳</th>
									<th data-options="field:'yfrjy',width:50,align:'center'" formatter = "format_sy">右副乳</th>
									<%}%>
									<th data-options="field:'sumjy',width:100,align:'center'" formatter = "format_sy">使用次数合计</th>
									
										
									
								
								
								
							<th data-options="field:'sum',width:50,align:'center',hidden:true" ></th>
						</tr>
					</thead>
			</table>
			<div id="productGXC_tb" >
				日期：
				<input id="productGXC_startTime" value='${startTime! }' class="easyui-datebox theme-textbox-radius"  data-options="editable: false"/>~
				<input id="productGXC_endTime" value='${date(),dateFormat="yyyy-MM-dd"}' class="easyui-datebox theme-textbox-radius" data-options="editable: false"/>
			</div>
		</div>
		<script type="text/javascript">
			$(document).ready(function () {
				//加载数据表格
				loadProductGXCTable();
				$('#productGXC_startTime').datebox({
					onSelect: function(date){
						loadProductGXCTable();
					}
				});
				$('#productGXC_endTime').datebox({
					onSelect: function(date){
						loadProductGXCTable();
					}
				});
			});
			
			function  loadProductGXCTable() {	
				var startTime = $("#productGXC_startTime").val();
				var endTime = $("#productGXC_endTime").val();
				var bbexp = $("#bbexp").val();
				var kbexp = $("#kbexp").val();
				var exp = $("#exp").val();
				var partnum = $("#partnum").val();
				var n = parseInt(partnum);
				$('#productGXCTable').datagrid({
					cls: "theme-datagrid",
					toolbar: '#productGXC_tb',
					singleSelect: true,
					rownumbers: true, //显示序号
					url: "${cxt!}/customerInfoStatistic/customerProductGXC",
					queryParams: {
						'customerIds': '${customerIds! }',
						'startTime': startTime,
						'endTime': endTime
					},
				    method: 'post',
					collapsible: true,
					onLoadSuccess:function(){
						
						 var rows = $('#productGXCTable').datagrid('getRows');
						if(rows.length > 0){
							$('#productGXCTable').datagrid('insertRow', {
								index:0,
								row:{
									
									date: '合计',
									jygm:compute_GXC('jygm'),
									ggm:compute_GXC('ggm'),
									ybg:compute_GXC('ybg'),
									gbg:compute_GXC('gbg'),
									dtg:compute_GXC('dtg'),
									xtg:compute_GXC('xtg'),
									bbg:compute_GXC('bbg'),
									kbg:compute_GXC('kbg'),
									zfrg:compute_GXC('zfrg'),
									yfrg:compute_GXC('yfrg'),
									sumg:compute_GXC('sumg'),
									ybjy:compute_GXC('ybjy'),
									gbjy:compute_GXC('gbjy'),
									dtjy:compute_GXC('dtjy'),
									xtjy:compute_GXC('xtjy'),
									bbjy:compute_GXC('bbjy'),
									kbjy:compute_GXC('kbjy'),
									zfrjy:compute_GXC('zfrjy'),
									yfrjy:compute_GXC('yfrjy'),
									sumjy:compute_GXC('sumjy'),
									jyjy:compute_GXC('jyjy'),
									gjy:compute_GXC('gjy')
									/* ,
									1gm:compute_GXC('ybg'),
									 */
									
									/*<%
										if(!isEmpty(products)){
											for(product in products){
												print(product.bh + '_gm : compute_GXC(\'' + product.bh + '_gm\'),');
												
												if(!isEmpty(parts)){
													for(part in parts){
														var field = product.bh + '_' + part.code;
														print(field + ' : compute_GXC(\'' + field + '\'),');
													}
													print(product.bh + '_sy : compute_GXC(\'' + product.bh + '_sy\'),');
												}
											}
										}
									%>*/
									//sum: compute_GXC('sum')
								}
								
				             });
					
						} 
					},
				})
			}
			
			
			//指定列求和
	        function compute_GXC(colName) {
	             var rows = $('#productGXCTable').datagrid('getRows');
	             var total = 0;
	             for (var i = 0; i < rows.length; i++) {
	            	 if(typeof(rows[i][colName]) != 'undefined'){
	            		 total += parseFloat(rows[i][colName]);
	            	 }
	             }
	             if(total > 0){
	            	 return total.toFixed(1);
	             }else{
	            	 return '';
	             }
	        }
			
			function format_sy(value,row){
				if(value == '0'){
					return "";
				}else{
					return value;
				}
				/* if(typeof(value) == 'number'){
					return value.toFixed(1);
           	 	}else{
           	 		return value;
           	 	} */
			}
			
		</script>
